package com.itheima.app.cotroller;

import com.itheima.app.manager.UserLocationManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class UserLocationController {

    @Autowired
    private UserLocationManager userLocationManager;

    //上报位置信息
    @PostMapping("/baidu/location")
    public void uploadLocation(@RequestBody Map<String ,String> map){
        String longitude = map.get("longitude");
        String latitude = map.get("latitude");
        String addrStr = map.get("addrStr");

        userLocationManager.uploadLocation(longitude , latitude ,addrStr);
    }

    //搜附近
    @GetMapping("/tanhua/search")
    public ResponseEntity searchNearUserId(@RequestParam  String gender,
                                           @RequestParam Double distance){
        return userLocationManager.searchNearUserId(gender ,distance);
    }
}
